home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / SharewareGames / Xconq 7.2.2 / lib / chess.g < prev    next >
Text File  |  1998-05-22  |  11KB  |  306 lines

  1. (game-module "chess"
  2.   (title "Xconq Chess")
  3.   (blurb "Xconq's answer to chess")
  4.   (instructions "This is more of an experiment than a real game."
  5.     "Move your pieces to try to capture the other player's king.")
  6.   )
  7.  
  8. (set use-side-priority true)
  9.  
  10. (unit-type w-pawn)
  11. (unit-type w-rook)
  12. (unit-type w-knight)
  13. (unit-type w-bishop)
  14. (unit-type w-queen)
  15. (unit-type w-king)
  16.  
  17. (define w-types (w-pawn w-rook w-knight w-bishop w-queen w-king))
  18.  
  19. (add w-types possible-sides "white")
  20.  
  21. (unit-type b-pawn)
  22. (unit-type b-rook)
  23. (unit-type b-knight)
  24. (unit-type b-bishop)
  25. (unit-type b-queen)
  26. (unit-type b-king)
  27.  
  28. (define b-types (b-pawn b-rook b-knight b-bishop b-queen b-king))
  29.  
  30. (add b-types possible-sides "black")
  31.  
  32. (define long-movers (w-rook w-bishop w-queen b-rook b-bishop b-queen))
  33.  
  34. (terrain-type edge (image-name "gray"))
  35. (terrain-type row1 (image-name "dark-gray"))
  36. (terrain-type row2 (image-name "light-gray"))
  37. (terrain-type row3 (image-name "dark-gray"))
  38. (terrain-type row4 (image-name "light-gray"))
  39. (terrain-type row5 (image-name "dark-gray"))
  40. (terrain-type row6 (image-name "light-gray"))
  41. (terrain-type row7 (image-name "dark-gray"))
  42. (terrain-type row8 (image-name "light-gray"))
  43. (terrain-type row9 (image-name "dark-gray"))
  44. (terrain-type row10 (image-name "light-gray"))
  45. (terrain-type row11 (image-name "dark-gray"))
  46.  
  47. ;;; Vision.
  48.  
  49. (set see-all true)
  50.  
  51. ;;; Actions.
  52.  
  53. (add u* acp-per-turn 1)
  54.  
  55. (add (w-knight b-knight) acp-min -2)
  56. (add long-movers acp-min -13)
  57.  
  58. ;;; Movement.
  59.  
  60. (add (w-pawn b-pawn) speed 10.00)
  61. (add (w-knight b-knight) speed 2.00)
  62. (add long-movers speed 13.00)
  63.  
  64. (add (w-knight b-knight) move-range 2)
  65. (add long-movers move-range 13)
  66.  
  67. (add (w-pawn b-pawn) free-mp 0)
  68.  
  69. (table mp-to-enter-terrain
  70.   (u* t* 1)
  71.   ;; Constrain pawns to only be able to move forward.
  72.   (w-pawn t* (10 5 5 4 4 3 3 2 2 1 1 0))
  73.   (b-pawn t* (10 0 1 1 2 2 3 3 4 4 5 5))
  74.   )
  75.  
  76. (table mp-to-leave-terrain
  77.   (u* t* 0)
  78.   ;; Constrain pawns to only be able to move forward.
  79.   (w-pawn t* (10  5  6 6 7 7 8 8 9 9 10 10))
  80.   (b-pawn t* (10 10 10 9 9 8 8 7 7 6  6  5))
  81.   )
  82.  
  83. ;;; Combat.
  84.  
  85. (table acp-to-attack
  86.   ((w-pawn b-pawn) u* 1)
  87.   ((w-knight b-knight) u* 2)
  88.   (long-movers u* 13)
  89.   ((w-king b-king) u* 1)
  90.   )
  91.  
  92. (table hit-chance (u* u* 100))
  93.  
  94. (table damage (u* u* 1))
  95.  
  96. (table counterattack (u* u* 0))
  97.  
  98. ;;; Scoring.
  99.  
  100. (add u* point-value 0)
  101. (add (w-king b-king) point-value 1)
  102.  
  103. (scorekeeper 1 (do last-side-wins))
  104.  
  105. ;;; Setup.
  106.  
  107. (area 15 13)
  108.  
  109. (area (terrain
  110.   (by-name
  111.     (edge 0) (row1 1) (row2 2) (row3 3) (row4 4)
  112.     (row5 5) (row6 6) (row7 7) (row8 8) (row9 9)
  113.     (row10 10) (row11 11))
  114.   "15a"
  115.   "a8l6a"
  116.   "a9k5a"
  117.   "a10j4a"
  118.   "a11i3a"
  119.   "a12h2a"
  120.   "a13ga"
  121.   "2a12fa"
  122.   "3a11ea"
  123.   "4a10da"
  124.   "5a9ca"
  125.   "6a8ba"
  126.   "15a"
  127. ))
  128.  
  129. (side 1 (name "White") (class "white") (emblem-name "none"))
  130.  
  131. (side 2 (name "Black") (class "black") (emblem-name "none"))
  132.  
  133. (w-pawn 5 2 1)
  134. (w-pawn 6 2 1)
  135. (w-pawn 7 2 1)
  136. (w-pawn 8 2 1)
  137. (w-pawn 9 2 1)
  138. (w-pawn 10 2 1)
  139. (w-pawn 11 2 1)
  140. (w-pawn 12 2 1)
  141. (w-pawn 13 2 1)
  142. (w-rook 6 1 1)
  143. (w-rook 13 1 1)
  144. (w-knight 7 1 1)
  145. (w-knight 12 1 1)
  146. (w-bishop 8 1 1)
  147. (w-bishop 11 1 1)
  148. (w-queen 9 1 1)
  149. (w-king 10 1 1)
  150.  
  151. (b-pawn 1 10 2)
  152. (b-pawn 2 10 2)
  153. (b-pawn 3 10 2)
  154. (b-pawn 4 10 2)
  155. (b-pawn 5 10 2)
  156. (b-pawn 6 10 2)
  157. (b-pawn 7 10 2)
  158. (b-pawn 8 10 2)
  159. (b-pawn 9 10 2)
  160. (b-rook 1 11 2)
  161. (b-rook 8 11 2)
  162. (b-knight 2 11 2)
  163. (b-knight 7 11 2)
  164. (b-bishop 3 11 2)
  165. (b-bishop 6 11 2)
  166. (b-queen 4 11 2)
  167. (b-king 5 11 2)
  168.  
  169. (game-module (design-notes (
  170.   "Each side should only be able to do one move each turn, and each piece"
  171.   "should have 1 acp, and get multiple moves with the one action."
  172.   )))
  173.  
  174. (imf "b-bishop" ((32 32)
  175.   (mono
  176.    "00000000/00000000/000c1800/001e3c00/001e3c00/000c1800/000c1800/001e3c00"
  177.    "001f7c00/003fbe00/007fdf00/007fef00/00ffef80/00fff780/00fff780/00fffb80"
  178.    "00fffb80/007ffb00/007ffb00/003ff600/003ff600/001c1c00/0003e000/001f7c00"
  179.    "001bec00/001ffc00/00fc1f80/01ffffc0/01fe3fc0/00800080/00000000/00000000")
  180.   (mask
  181.    "00000000/00000000/000c1800/001e3c00/001e3c00/000c1800/000c1800/001e3c00"
  182.    "001f7c00/003ffe00/007fff00/007fff00/00ffff80/00ffff80/00ffff80/00ffff80"
  183.    "00ffff80/007fff00/007fff00/003ffe00/003ffe00/001ffc00/0003e000/001ffc00"
  184.    "001ffc00/001ffc00/00ffff80/01ffffc0/01fe3fc0/00800080/00000000/00000000")))
  185. (imf "b-king" ((32 32)
  186.   (mono
  187.    "00000000/00000000/0007f000/0005d000/0006b000/00077000/0006b000/07c5d1f0"
  188.    "0ff7f7f8/1ff80ffc/1e3c1e3c/3dde3dde/3bef7bee/3beffbee/3bf7f7ee/3df7f7de"
  189.    "1dfbefdc/1efbefbc/0f7bef78/07a002f0/021ffc20/03ffffe0/01fe3fc0/019ffcc0"
  190.    "01ffffc0/00f00780/008ff880/00ffff80/007fff00/000ff800/00000000/00000000")
  191.   (mask
  192.    "00000000/00000000/0007f000/0007f000/0007f000/0007f000/0007f000/07c7f1f0"
  193.    "0ff7f7f8/1ffffffc/1ffffffc/3ffffffe/3ffffffe/3ffffffe/3ffffffe/3ffffffe"
  194.    "1ffffffc/1ffffffc/0ffffff8/07fffff0/03ffffe0/03ffffe0/01ffffc0/01ffffc0"
  195.    "01ffffc0/00ffff80/00ffff80/00ffff80/007fff00/000ff800/00000000/00000000")))
  196. (imf "b-knight" ((32 32)
  197.   (mono
  198.    "00000000/00480000/006c0000/007e0000/00770000/007fc000/00fff000/00e7d800"
  199.    "01ebfc00/01fff600/03fff700/07fff700/07fffd80/0feffd80/19ff7dc0/1ff6fdc0"
  200.    "1fe1ff60/09c3ff60/0387ff60/030fff70/000fffd0/001fffb0/001fffb8/003fffb8"
  201.    "003fffb8/003fffb8/007ffffc/007ffffc/007ffffc/007ffffc/00000000/00000000")
  202.   (mask
  203.    "00000000/00480000/006c0000/007e0000/007f0000/007fc000/00fff000/00fff800"
  204.    "01fffc00/01fffe00/03ffff00/07ffff00/07ffff80/0fffff80/1fffffc0/1ff7ffc0"
  205.    "1fe1ffe0/09c3ffe0/0387ffe0/030ffff0/000ffff0/001ffff0/001ffff8/003ffff8"
  206.    "003ffff8/003ffff8/007ffffc/007ffffc/007ffffc/007ffffc/00000000/00000000")))
  207. (imf "b-pawn" ((32 32)
  208.   (mono
  209.    "00000000/00000000/00000000/00000000/0001c000/0003e000/0003e000/0003e000"
  210.    "0001c000/0007f000/000ff800/001ffc00/001ffc00/0001c000/0001c000/0001c000"
  211.    "0003e000/0003e000/0003e000/0007f000/0007f000/0007f000/0003e000/0003e000"
  212.    "001ffc00/007fff00/00ffff80/00ffff80/00ffff80/00000000/00000000/00000000")
  213.   (mask
  214.    "00000000/00000000/00000000/00000000/0001c000/0003e000/0003e000/0003e000"
  215.    "0001c000/0007f000/000ff800/001ffc00/001ffc00/0001c000/0001c000/0001c000"
  216.    "0003e000/0003e000/0003e000/0007f000/0007f000/0007f000/0003e000/0003e000"
  217.    "001ffc00/007fff00/00ffff80/00ffff80/00ffff80/00000000/00000000/00000000")))
  218. (imf "b-queen" ((32 32)
  219.   (mono
  220.    "00000000/00000000/00000000/00000000/00000000/001c1c00/003e3e00/0e3e3e38"
  221.    "1f1c1c7c/1f08087c/0e1c1c38/041c1c10/063e3e30/073e3e70/07bf7ef0/07fffff0"
  222.    "07fffff0/03e003e0/021ffc20/03fe3fe0/01ffffc0/019ffcc0/01ffffc0/00f00780"
  223.    "008ff880/00ffff80/007fff00/000ff800/00000000/00000000/00000000/00000000")
  224.   (mask
  225.    "00000000/00000000/00000000/00000000/00000000/001c1c00/003e3e00/0e3e3e38"
  226.    "1f1c1c7c/1f08087c/0e1c1c38/041c1c10/063e3e30/073e3e70/07bf7ef0/07fffff0"
  227.    "07fffff0/03ffffe0/03ffffe0/03ffffe0/01ffffc0/01ffffc0/01ffffc0/00ffff80"
  228.    "00ffff80/00ffff80/007fff00/000ff800/00000000/00000000/00000000/00000000")))
  229. (imf "b-rook" ((32 32)
  230.   (mono
  231.    "00000000/00000000/00000000/00000000/03c3c3c0/03ffffc0/03ffffc0/03ffffc0"
  232.    "01ffff80/00ffff00/00400200/007ffe00/007ffe00/007ffe00/007ffe00/007ffe00"
  233.    "007ffe00/007ffe00/00400200/00ffff00/00ffff00/00ffff00/01ffff80/01ffff80"
  234.    "01ffff80/03ffffc0/03ffffc0/03ffffc0/03ffffc0/00000000/00000000/00000000")
  235.   (mask
  236.    "00000000/00000000/00000000/00000000/03c3c3c0/03ffffc0/03ffffc0/03ffffc0"
  237.    "01ffff80/00ffff00/007ffe00/007ffe00/007ffe00/007ffe00/007ffe00/007ffe00"
  238.    "007ffe00/007ffe00/007ffe00/00ffff00/00ffff00/00ffff00/01ffff80/01ffff80"
  239.    "01ffff80/03ffffc0/03ffffc0/03ffffc0/03ffffc0/00000000/00000000/00000000")))
  240. (imf "w-bishop" ((32 32)
  241.   (mono
  242.    "00000000/00000000/000c1800/00122400/00122400/000c1800/000c1800/00122400"
  243.    "00114400/00208200/00404100/00402100/00802080/00801080/00801080/00800880"
  244.    "00800880/00400900/00400900/00201200/00201200/0013e400/000c1800/00108400"
  245.    "00141400/00100400/00ffff80/01014040/017e3f40/00800080/00000000/00000000")
  246.   (mask
  247.    "00000000/00000000/000c1800/001e3c00/001e3c00/000c1800/000c1800/001e3c00"
  248.    "001f7c00/003ffe00/007fff00/007fff00/00ffff80/00ffff80/00ffff80/00ffff80"
  249.    "00ffff80/007fff00/007fff00/003ffe00/003ffe00/001ffc00/000ff800/001ffc00"
  250.    "001ffc00/001ffc00/00ffff80/01ff7fc0/01fe3fc0/00800080/00000000/00000000")))
  251. (imf "w-king" ((32 32)
  252.   (mono
  253.    "00000000/00000000/0007f000/00063000/00055000/00049000/00055000/07c631f0"
  254.    "0837f608/10080804/10041004/20022002/20014002/20008002/20000002/20000002"
  255.    "10000004/10000004/08000008/041ffc10/03e003e0/02000020/0101c040/01600340"
  256.    "01000040/008ff880/00f00780/00800080/00700700/000ff800/00000000/00000000")
  257.   (mask
  258.    "00000000/00000000/0007f000/0007f000/0007f000/0007f000/0007f000/07c7f1f0"
  259.    "0ff7f7f8/1ffffffc/1ffffffc/3ffffffe/3ffffffe/3ffffffe/3ffffffe/3ffffffe"
  260.    "1ffffffc/1ffffffc/0ffffff8/07fffff0/03ffffe0/03ffffe0/01ffffc0/01ffffc0"
  261.    "01ffffc0/00ffff80/00ffff80/00ffff80/007fff00/000ff800/00000000/00000000")))
  262. (imf "w-knight" ((32 32)
  263.   (mono
  264.    "00000000/00480000/006c0000/007e0000/00490000/0048c000/00803000/009c2800"
  265.    "011a0400/01000a00/02000900/04000900/04000280/08100280/10084240/10178240"
  266.    "172100a0/094200a0/028400a0/03080090/00080030/00100050/00100048/00200048"
  267.    "00200048/00200048/00400004/00400004/00400004/007ffffc/00000000/00000000")
  268.   (mask
  269.    "00000000/00480000/006c0000/007e0000/007f0000/007fc000/00fff000/00fff800"
  270.    "01fffc00/01fffe00/03ffff00/07ffff00/07ffff80/0fffff80/1fffffc0/1ff7ffc0"
  271.    "1fe1ffe0/09c3ffe0/0387ffe0/030ffff0/000ffff0/001ffff0/001ffff8/003ffff8"
  272.    "003ffff8/003ffff8/007ffffc/007ffffc/007ffffc/007ffffc/00000000/00000000")))
  273. (imf "w-pawn" ((32 32)
  274.   (mono
  275.    "00000000/00000000/00000000/00000000/0001c000/00022000/00022000/00022000"
  276.    "00014000/00077000/00080800/00100400/001ffc00/00014000/00014000/00014000"
  277.    "00022000/00022000/00022000/00041000/00041000/00041000/00022000/00022000"
  278.    "001c1c00/00600300/00800080/00800080/00ffff80/00000000/00000000/00000000")
  279.   (mask
  280.    "00000000/00000000/00000000/00000000/0001c000/0003e000/0003e000/0003e000"
  281.    "0001c000/0007f000/000ff800/001ffc00/001ffc00/0001c000/0001c000/0001c000"
  282.    "0003e000/0003e000/0003e000/0007f000/0007f000/0007f000/0003e000/0003e000"
  283.    "001ffc00/007fff00/00ffff80/00ffff80/00ffff80/00000000/00000000/00000000")))
  284. (imf "w-queen" ((32 32)
  285.   (mono
  286.    "00000000/00000000/00000000/00000000/00000000/001c1c00/00222200/0e222238"
  287.    "111c1c44/11080844/0e141438/04141410/06222230/05222250/04a14290/04408110"
  288.    "04000010/021ffc20/03e003e0/02000020/0101c040/01600340/01000040/008ff880"
  289.    "00f00780/00800080/00700700/000ff800/00000000/00000000/00000000/00000000")
  290.   (mask
  291.    "00000000/00000000/00000000/00000000/00000000/001c1c00/003e3e00/0e3e3e38"
  292.    "1f1c1c7c/1f08087c/0e1c1c38/041c1c10/063e3e30/073e3e70/07bf7ef0/07fffff0"
  293.    "07fffff0/03ffffe0/03ffffe0/03ffffe0/01ffffc0/01ffffc0/01ffffc0/00ffff80"
  294.    "00ffff80/00ffff80/007fff00/000ff800/00000000/00000000/00000000/00000000")))
  295. (imf "w-rook" ((32 32)
  296.   (mono
  297.    "00000000/00000000/00000000/00000000/03c3c3c0/023c3c40/02000040/02000040"
  298.    "01000080/00800100/007ffe00/00400200/00400200/00400200/00400200/00400200"
  299.    "00400200/00400200/007ffe00/00800100/00800100/00800100/01000080/01000080"
  300.    "01000080/02000040/02000040/02000040/03ffffc0/00000000/00000000/00000000")
  301.   (mask
  302.    "00000000/00000000/00000000/00000000/03c3c3c0/03ffffc0/03ffffc0/03ffffc0"
  303.    "01ffff80/00ffff00/007ffe00/007ffe00/007ffe00/007ffe00/007ffe00/007ffe00"
  304.    "007ffe00/007ffe00/007ffe00/00ffff00/00ffff00/00ffff00/01ffff80/01ffff80"
  305.    "01ffff80/03ffffc0/03ffffc0/03ffffc0/03ffffc0/00000000/00000000/00000000")))
  306.